﻿using System.Collections;
using System.Collections.Generic;
using UBlockly.Scriptable;
using UnityEngine;
using UBlockly.Compotent;
using UnityEngine.UI;
using System;
using UnityEngine.EventSystems;

namespace UBlockly.UI
{
    [RequireComponent(typeof(UImage))]
    [RequireComponent(typeof(UBlockAnchor))]
    public sealed class PackTypeBlock : BlockObject
    {
        private Type resultType;
        public ILVarType PackType => Node.Value.Scriptable.ResultType;
        public uint PackTypeCode => Node.Value.Scriptable.VarReturnCode;

        public Type PackReturnType
        {
            get
            {
                if (resultType == null)
                    resultType = TranslateHelper.GetVarTypeByVarTypeName(Node.Value.Scriptable.ResultTypeStr);
                return resultType;
            }
        }

        protected override void Awake()
        {
            base.Awake();
            GetComponent<UBlockAnchor>().InitMinHeiht(BlockGraphicSize.BlockMinHeight);
        }
    }

    [RequireComponent(typeof(UBlockAnchor))]
    public sealed class DefaultTypeBlock : BlockObject
    {
    }
}

